//
//  JNTTaskViewController.m
//  CRSCMOA
//
//  Created by 王文晓 on 16/8/9.
//  Copyright © 2016年 王文晓. All rights reserved.
//

#import "JNTTaskViewController.h"
#import "TaskTableViewCell.h"

@interface JNTTaskViewController ()<MyViewDelget,UITableViewDataSource,UITableViewDelegate>

@property (nonatomic, strong) UITableView *tableView;
@end

@implementation JNTTaskViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpNavgationBar];
    //    初始化自定义btn
    NSArray *ar = @[@"代办",@"已办"];
    MyView *myView = [[MyView alloc]initWithArr:ar Bol:YES];
    myView.delget = self;
    [self.view addSubview:myView];
    [self.view addSubview:self.tableView];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}




#pragma mark - -----------tableView的代理方法--------
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 3;
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 100;
}
//cell赋值
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    TaskTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TaskTableViewCell" forIndexPath:indexPath];
    
  
    
    return cell;
}

//cell点击
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
  
}

//自定义SegmentedControl的回调事件
-(void)buttonAction:(id)but{
    UIButton* but1 = but;
//    NSLog(@"-- %ld",(long)but1.tag);
    
    if (but1.tag == 1000) {
        
        
    }else if (but1.tag == 1001){
        
    }
    
}
//left按钮回调
- (void)leftBtnClick
{
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark - 设置导航条
- (void)setUpNavgationBar
{
    self.title = @"移动平台任务";
    self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;
    self.navigationController.navigationBar.translucent = NO;
    UIBarButtonItem *backBtnItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageWithOriginalName:@"返回按钮.png"] style:UIBarButtonItemStylePlain target:self action:@selector(leftBtnClick)];
    self.navigationItem.leftBarButtonItem = backBtnItem;
}


#pragma mark --视图懒加载-
- (UITableView *)tableView {
    
    if (!_tableView) {
        
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 40, kScreenWidth, kScreenHeight-104) style:UITableViewStylePlain];
       
        _tableView.delegate = self;
        _tableView.dataSource = self;
        [_tableView registerNib:[UINib nibWithNibName:@"TaskTableViewCell" bundle:nil] forCellReuseIdentifier:@"TaskTableViewCell"];
    }
    return _tableView;
}

@end
